-- random_spell_bonus
-- create by xinj
-- 道具：  随机卷轴奖励

return {
    apply = function(source, target, classId, value)
        -- 土、火、气、暗1~4阶卷轴
        local spell = {
                { 4001, 4021, 4031, 4051, },
                { 4002, 4022, 4032, 4052, },
                { 4003, 4023, 4033, 4053, },
                { 4004, 4024, 4034, 4054, },
                        };

        -- 权重配比
        local weight = { 4, 3, 2, 1, };
        local allNum = 10;

        -- 奖励列表
        local id;
        local num;
        for i = 1, 4 do
            id = FormulaM.invoke("FETCH_BY_RAND", spell[i], DungeonM.getRandSeed("property_spell_rand_bonus"));
            num = math.modf(value * weight[i] / allNum);
            BonusM.doBonus( {1, id, num}, "property_spell_rand_bonus");
        end
    end,
};
